<?php
defined('APP') or die('Do not have permission to access');

abstract class Core_Controller extends BaseInit
{
    protected $view;

    public function __construct() //Hàm tạo sẽ tạo một biến có cơ chế protected $view gọi đối tượng View
    {
        parent::__construct();
        $layout = array();
        $body = false;
        if(isset(Core::$config["loadLayout"][SECTION])) {
            $layout = Core::$config["loadLayout"][SECTION];
            $body = true;
        }
        $this->view = new Core_View($layout, $body);
    }

    private function checkLogin() {
        if(__session("log.user") == null && $this->request->getGetString("mod") != "user") {
            $this->response->redirect("?mod=user&task=login");
        }
    }
}